<?php
/**
 * Created by Command.
 * User: Vito
 */

namespace app\admin\curd\water_ele_record;

use app\common\curd\Index;

class WaterEleRecordIndex extends Index
{
    /**
     * 关键词查询指定字段
     * @var string[]
     */
    protected $keywordQueryArgs = [];
    //追加标签数据
    protected $labelCallback = [];
    //查询条件
    protected $where = [];
    //字段
    protected $field = [];
    //排除字段
    protected $withoutField = false;
    //关联
    protected $with = [ 'repairUser', 'adminUser','room'];
    /**
     * 需要查询条件的字段
     * 数据库字段和参数字段名不一样 'db_field' => 'param_field'
     * 数据库字段和参数字段名一样 'field'
     * @var array
     */
    protected $queryField = [];
    protected function formatMiddleware($next)
    {
        $response = $next();
        // $housing = new Housing;
        // $arr = $housing->getDetail();
        // print_r(count($response['buildingg']));

        // die;
        foreach ($response as $key => $value) {
            // print_r($value['fee']);
            $response[$key]['record_dates'] = date("Y-m-d", $value['record_date']);

            // $children =  $response[$key]['children'];
            // foreach ($children as $index => $item) {
            //     $children[$index]['fee_date'] = date("Y-m-d", $item['fee_date']);
            // }
        }
        // halt($response);
        // $this->setData('extend' , $arr);
        return $response;
    }
}